(0.2.2) Compare and find patterns
As information gathering progresses and materials come in your brain, "abstraction" occur next. Abstraction has a strong relationship with finding common patterns from multiple pieces of concrete information and judging what part is important. Comparing multiple things and finding the similarity helps abstraction. Let's look at the following code which outputs "Hello, world!" in the programming language Python. code:code 1: outputs "Hello, world!"
print("Hello, world!")
code:output
Hello, world!
Even if you do not have experience of Python, you will notice that there is a common part by comparing the code with the output. This is pattern discovery. code: Patterns you found
print("What you wrote here is displayed")
If you want to output "Bye, world!", you know which part to rewrite. In other words, by discovering the pattern, you gain the ability to modify the program according to your purpose.
The next code also outputs "Hello, world!". However if I show it to Python beginners, they can't modify it. They can't find a common part between the output "Hello, world!" and the source code. (*1)
code:code 1: outputs "Hello, world!"
print("".join(map(chr, [72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33])))
In this book, I would like to help you discover common patterns of intellitech by comparing multiple intellitechs.
Footnote *1: Intelligent people might think that complicated code starting with "".join makes the string "Hello, world!" by comparing code 1 and code 2. That is correct, but since this book is not a Python textbook, I do not give a detailed explanation.
en.icon
---
This page is auto-translated from /nishio/(0.2.2) Compare and find patterns. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.